#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<stdlib.h>

typedef struct ListNode
{
	int value;
	struct ListNode* next;
}node;

node* creat(int* values, int n)
{
	if (n == 0)return NULL;
	node* head = (node*)malloc(sizeof(node));
	head->value = values[0];
	head->next = NULL;
	node* cur = head;

	for (int i = 1; i < n; i++)
	{
		node* newnode = (node*)malloc(sizeof(node));
		newnode->value = values[i];
		newnode->next = NULL;
		cur->next = newnode;
		cur = newnode;
	}
	return head;
}

node* merge(node* l1, node* l2)
{
	node dummy;
	node* tail = &dummy;
	dummy.next = NULL;

	if (l1->value <= l2->value)
	{
		tail->next = l1;
		l1 = l1->next;
	}
	else
	{
		tail->next = l2;
		l2 = l2->next;
	}

	if (l1 != NULL)
	{
		tail->next = l1;
	}
	else
	{
		tail->next = l2;
	}
	
	return dummy.next;
}

void print(node* head)
{
	while (head != NULL)
	{
		printf("%d", head->value);
		head = head->next;
	}
}

int main()
{
	int values1[100], values2[100];
	int n1 = 0, n2 = 0;

	while (scanf("%d", &values1[n1]) != EOF)
	{
		if (values1[n1] == '\n')break;
		n1++;
	}
	while (scanf("%d", &values2[n2]) != EOF)
	{
		if (values2[n2] == '\n') break;
		n2++;
	}

	node* l1 = creat(values1, n1);
	node* l2 = creat(values2, n2);

	node* list = merge(l1, l2);

	print(list);
	return 0;
}